package com.adaydayup.week3;

public class MinDeletionSize944 {
    /*944删列造序
    给你由 n 个小写字母字符串组成的数组 strs，其中每个字符串长度相等。
    这些字符串可以每个一行，排成一个网格。例如，strs = ["abc", "bce", "cae"] 可以排列为：
    abc
    bce
    cae
     */
    public static void main(String[] args) {
        String[] a={"abc", "bce", "cae"};
        MinDeletionSize944 minDS = new MinDeletionSize944();
        int res = minDS.minDeletionSize(a);
        System.out.println(res);
    }

    public int minDeletionSize(String[] strs){
        int row = strs.length;
        int col = strs[0].length();
        int ans=0;
        for (int i = 0; i < col; i++) {
            for (int j = 0; j < row; j++) {
                if (strs[j-1].charAt(i)>strs[j].charAt(i)){
                    ans++;
                    break;
                }
            }
        }
        return ans;
    }
}
